import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path:"/",
      redirect:"/home"
    },
    {
      path: '/login',
      name: 'login',
      component: () => import('../views/login.vue')
    },
    {
      path: '/home',
      name: 'home',
      component: HomeView
    },
    {
      path: '/about',
      name: 'about',
      // route level code-splitting
      // this generates a separate chunk (About.[hash].js) for this route
      // which is lazy-loaded when the route is visited.
      component: () => import('../views/AboutView.vue')
    },
    {
      path: '/car',
      name: 'car',
      component: () => import('../views/car.vue')
    },
    {
      path:"/user",
      name:"user",
      component: () => import('../views/user.vue')
    },
    {
      path:"/search",
      name:"search",
      component: () => import('../views/search.vue')
    },
    {
      path:"/regist",
      name:"regist",
      component: () => import('../views/regist/regist.vue'),
      children:[
        {
          path:"step1",
          name:"step1",
          component: () => import('../views/regist/step1.vue'),
        },
        {
          path:"step2",
          name:"step2",
          component: () => import('../views/regist/step2.vue'),
        },
        {
          path:"step3",
          name:"step3",
          component: () => import('../views/regist/step3.vue'),
        }
      ]
    },
    {
      path:"/detail/:id",
      name:"detail",
      component: () => import('../views/detail.vue')
    },
    {
      path:"/address",
      name:"address",
      component: () => import('../views/address.vue')
    },
    {
        path:"/order",
        name:"order",
        component: () => import('../views/order.vue')
    }
  ]
})

export default router
